{"ast":null,"code":"var _jsxFileName = \"/Users/iliyagladkov/Documents/GitHub/to-do-react/src/App.js\",\n  _s = $RefreshSig$();\nimport { useState, useEffect } from 'react';\nimport ToDoList from './components/ToDoList';\nimport ToDoForm from './components/UI/forms/ToDoForm';\nimport MyButtonAdd from './components/UI/MyButton/MyButtonAdd/MyButtonAdd';\nimport MyModal from './components/UI/MyModal/MyModal';\nimport './style/App.css';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nfunction App() {\n  _s();\n  const [toDoItems, setToDoItems] = useState([]);\n  const [modal, setModal] = useState(false);\n  function createToDoItem(newToDoItem) {\n    setToDoItems([...toDoItems, newToDoItem]);\n    setModal(false);\n  }\n  function removeToDOItem(toDoItem) {\n    setToDoItems(toDoItems.filter(toDo => toDo.id !== toDoItem.id));\n  }\n  localStorage.setItem('tasks', JSON.stringify(toDoItems));\n  let backFromStorage = JSON.parse(localStorage.getItem('tasks'));\n  useEffect(() => {\n    setToDoItems([...toDoItems, ...backFromStorage]);\n  }, []);\n  return /*#__PURE__*/_jsxDEV(\"div\", {\n    className: \"App\",\n    children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n      style: {\n        marginTop: '10px'\n      },\n      className: \"header\",\n      children: \"TO-DO LIST\"\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 32,\n      columnNumber: 7\n    }, this), /*#__PURE__*/_jsxDEV(\"hr\", {\n      style: {\n        marginTop: '15px',\n        width: '100%'\n      }\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 33,\n      columnNumber: 7\n    }, this), toDoItems.length === 0 ? /*#__PURE__*/_jsxDEV(\"h2\", {\n      style: {\n        margin: '15px',\n        color: 'red'\n      },\n      children: \"To-Do items not found...\"\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 36,\n      columnNumber: 9\n    }, this) : /*#__PURE__*/_jsxDEV(ToDoList, {\n      remove: removeToDOItem,\n      toDoItems: toDoItems\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 38,\n      columnNumber: 9\n    }, this), /*#__PURE__*/_jsxDEV(MyButtonAdd, {\n      onClick: () => setModal(true)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 40,\n      columnNumber: 7\n    }, this), /*#__PURE__*/_jsxDEV(MyModal, {\n      visible: modal,\n      setVisible: setModal,\n      children: /*#__PURE__*/_jsxDEV(ToDoForm, {\n        create: createToDoItem\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 45,\n        columnNumber: 9\n      }, this)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 41,\n      columnNumber: 7\n    }, this)]\n  }, void 0, true, {\n    fileName: _jsxFileName,\n    lineNumber: 31,\n    columnNumber: 5\n  }, this);\n}\n_s(App, \"7FIISFP6Yvib4ukeVmrBWUYSbRA=\");\n_c = App;\nexport default App;\nvar _c;\n$RefreshReg$(_c, \"App\");","map":{"version":3,"names":["useState","useEffect","ToDoList","ToDoForm","MyButtonAdd","MyModal","App","toDoItems","setToDoItems","modal","setModal","createToDoItem","newToDoItem","removeToDOItem","toDoItem","filter","toDo","id","localStorage","setItem","JSON","stringify","backFromStorage","parse","getItem","marginTop","width","length","margin","color"],"sources":["/Users/iliyagladkov/Documents/GitHub/to-do-react/src/App.js"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport ToDoList from './components/ToDoList';\nimport ToDoForm from './components/UI/forms/ToDoForm';\nimport MyButtonAdd from './components/UI/MyButton/MyButtonAdd/MyButtonAdd'\nimport MyModal from './components/UI/MyModal/MyModal';\nimport './style/App.css';\n\nfunction App() {\n\n  const [toDoItems, setToDoItems] = useState([])\n  const [modal, setModal] = useState(false)\n\n  function createToDoItem(newToDoItem) {\n    setToDoItems([...toDoItems, newToDoItem])\n    setModal(false)\n  }\n\n  function removeToDOItem(toDoItem) {\n    setToDoItems(toDoItems.filter(toDo => toDo.id !== toDoItem.id))\n  }\n\n  localStorage.setItem('tasks', JSON.stringify(toDoItems))\n\n  let backFromStorage = JSON.parse(localStorage.getItem('tasks'));\n\n  useEffect(() => {\n    setToDoItems([...toDoItems, ...backFromStorage])\n  },[])\n\n  return (\n    <div className=\"App\">\n      <h1 style={{marginTop: '10px'}} className='header'>TO-DO LIST</h1>\n      <hr style={{marginTop: '15px', width: '100%'}}/>\n      {toDoItems.length === 0\n        ?\n        <h2 style={{margin: '15px', color: 'red'}}>To-Do items not found...</h2>\n        :\n        <ToDoList remove={removeToDOItem} toDoItems={toDoItems}></ToDoList>\n      }\n      <MyButtonAdd onClick={() => setModal(true)}/>\n      <MyModal\n        visible={modal}\n        setVisible={setModal}\n      >\n        <ToDoForm create={createToDoItem}/>\n      </MyModal>\n    </div>\n  );\n}\n\nexport default App;\n"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAC3C,OAAOC,QAAQ,MAAM,uBAAuB;AAC5C,OAAOC,QAAQ,MAAM,gCAAgC;AACrD,OAAOC,WAAW,MAAM,kDAAkD;AAC1E,OAAOC,OAAO,MAAM,iCAAiC;AACrD,OAAO,iBAAiB;AAAC;AAEzB,SAASC,GAAG,GAAG;EAAA;EAEb,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGR,QAAQ,CAAC,EAAE,CAAC;EAC9C,MAAM,CAACS,KAAK,EAAEC,QAAQ,CAAC,GAAGV,QAAQ,CAAC,KAAK,CAAC;EAEzC,SAASW,cAAc,CAACC,WAAW,EAAE;IACnCJ,YAAY,CAAC,CAAC,GAAGD,SAAS,EAAEK,WAAW,CAAC,CAAC;IACzCF,QAAQ,CAAC,KAAK,CAAC;EACjB;EAEA,SAASG,cAAc,CAACC,QAAQ,EAAE;IAChCN,YAAY,CAACD,SAAS,CAACQ,MAAM,CAACC,IAAI,IAAIA,IAAI,CAACC,EAAE,KAAKH,QAAQ,CAACG,EAAE,CAAC,CAAC;EACjE;EAEAC,YAAY,CAACC,OAAO,CAAC,OAAO,EAAEC,IAAI,CAAC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